Revert "nbd: freeze the queue while we're adding connections"#886
Revert "nbd: freeze the queue while we're adding connections"#886blktests-ci[bot] wants to merge 1 commit into
Conversation
|
Upstream branch: eed108e |
de94ac7 to
86d8d37
Compare
|
Upstream branch: e8c2f9f |
3ce8dc4 to
7b1d886
Compare
86d8d37 to
9805659
Compare
|
Upstream branch: eb3f4b7 |
7b1d886 to
c496e42
Compare
9805659 to
3f4a345
Compare
|
Upstream branch: 8fde5d1 |
c496e42 to
6eb8dbf
Compare
3f4a345 to
c6dc343
Compare
|
Upstream branch: e43ffb6 |
6eb8dbf to
760c820
Compare
c6dc343 to
fc36596
Compare
|
Upstream branch: ba3e43a |
760c820 to
b6ca782
Compare
fc36596 to
7bed9c3
Compare
|
Upstream branch: ddd664b |
b6ca782 to
0e0f395
Compare
7bed9c3 to
a7bb5c5
Compare
|
Upstream branch: 979c294 |
0e0f395 to
ae4a79e
Compare
a7bb5c5 to
5e41a3b
Compare
|
Upstream branch: acb7500 |
ae4a79e to
c734978
Compare
5e41a3b to
c3a084b
Compare
|
Upstream branch: 9716c08 |
c734978 to
aa3d627
Compare
c3a084b to
5f78e5d
Compare
|
Upstream branch: 2a2974b |
aa3d627 to
7ada834
Compare
5f78e5d to
e48f9db
Compare
|
Upstream branch: 062871f |
7ada834 to
5725313
Compare
199644a to
e6d9eb8
Compare
|
Upstream branch: 66affa3 |
5725313 to
8c461d7
Compare
e6d9eb8 to
7d8604f
Compare
This reverts commit b98e762. Commit b98e762 ("nbd: freeze the queue while we're adding connections") added blk_mq_freeze_queue/blk_mq_unfreeze_queue in nbd_add_socket() to protect krealloc(config->socks) from concurrent I/O that could cause a Use-After-Free. However, analysis shows that in all current code paths, concurrent I/O cannot actually reach nbd_add_socket(): 1. nbd_genl_connect() path: nbd_add_socket() is called first, and nbd_start_device() -- which starts the queue and enables I/O -- is called only after all sockets have been added. So the freeze/unfreeze runs against an idle queue, marking then waiting on a percpu_ref that is already zero, and then resurrecting it -- a pure no-op that burns an RCU grace period per socket on multi-core systems. 2. nbd_ioctl(NBD_SET_SOCK) path: The task_setup check enforces that only the thread which performed the first NBD_SET_SOCK can call NBD_SET_SOCK again. That thread is blocked in NBD_DO_IT's wait_event_interruptible, so it cannot issue another NBD_SET_SOCK concurrently with I/O. Other threads are rejected by the task_setup != current check. 3. nbd_genl_reconfigure() does not call nbd_add_socket() at all; it uses nbd_reconnect_socket() which replaces a dead socket in-place without reallocating config->socks. Therefore the freeze/unfreeze provides no actual protection in any reachable code path, while imposing the cost of blk_mq_freeze_queue (percpu_ref_kill + RCU grace period wait + percpu_ref_resurrect) on every socket addition during device setup[1]. Revert the change to eliminate the unnecessary overhead. Link: https://lore.kernel.org/all/20260327091223.4147956-1-leo.lilong@huaweicloud.com/ [1] Signed-off-by: Yang Erkun <yangerkun@huawei.com>
|
Upstream branch: bade58e |
8c461d7 to
999e524
Compare
Pull request for series with
subject: Revert "nbd: freeze the queue while we're adding connections"
version: 1
url: https://patchwork.kernel.org/project/linux-block/list/?series=1100929